package com.作业.Day18;


/**
 * 显示优先级
 */
public class Homework1 {
    public static void main(String[] args) {
        System.out.println("**********默认优先级********");
        System.out.println("主线程名"+Thread.currentThread().getName()+"优先级"+Thread.currentThread().getPriority());
        Thread thread = new Thread(() -> {
            System.out.println("启动线程");
        }, "Thread-0");
        System.out.println("子线程名"+thread.getName()+"优先级"+thread.getPriority());
        System.out.println("**********修改默认优先级********");
        Thread.currentThread().setPriority(10);
        System.out.println("主线程名"+Thread.currentThread().getName()+"优先级"+Thread.currentThread().getPriority());
        thread.setPriority(1);
        System.out.println("子线程名"+thread.getName()+"优先级"+thread.getPriority());
    }
}
